#include<stdio.h>
void BubbleSort(int* nums, int N)
{
	for (int i = 1; i < N; i++)
	{
		int isSort = 0;
		for (int j = 0; j < N - i; j++)
		{
			if (nums[j] > nums[j + 1])
			{
				isSort = 1;
				int temp = nums[j];
				nums[j] = nums[j + 1];
				nums[j + 1] = temp;
			}
		}
		if (isSort == 0)
		{
			return;
		}
	}
}
int main()
{
	int arr[] = { 5,8,1,2,3,7,4 };
	BubbleSort(arr, 7);
	for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		printf("%d ", arr[i]);
	}
}